package com.fizy.client.utils;

import java.net.URI;
import java.net.URL;

public class MyURLEncoder {
	public static String encode(String str) throws Exception {
		String defaultUrl = "http://www.example.com/";
		String urlStr = defaultUrl + str;
		URL url = new URL(urlStr);
		URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(),
				url.getQuery(), url.getRef());
		String result = uri.toASCIIString().replace(defaultUrl, "");
		return result;
	}
}
